package com.liyuxiang.yygh.hosp.controller;

import com.liyuxiang.yygh.common.result.Result;
import com.liyuxiang.yygh.hosp.service.ScheduleService;
import com.liyuxiang.yygh.model.hosp.Schedule;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {
    @Autowired
    ScheduleService scheduleService;

    @GetMapping("/getScheduleRule/{page}/{limit}/{hocode}/{depcode}")
    @ApiOperation("查询排版规则数据")
    public Result getScheduleRule(@PathVariable("page") int page, @PathVariable("limit") int limit, @PathVariable("hocode") String hocode, @PathVariable("depcode") String depcode) {
        Map<String, Object> map = scheduleService.getScheduleRule(page, limit, hocode, depcode);
        return Result.ok(map);
    }

    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{date}")
    @ApiOperation("获取排版详细信息")
    public Result getScheduleDetail(@PathVariable("hoscode") String hoscode, @PathVariable("depcode") String depcode, @PathVariable("date") String date) {
        List<Schedule> list = scheduleService.getScheduleDetail(hoscode, depcode, date);
        return Result.ok(list);
    }
}
